﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;

/// <summary>
/// Summary description for Utils
/// </summary>
public class Utils
{
    public static int ADMIN = 0;
    public static int MANAGER = 1;
    public static int USER = 2;
    public static String rootAdmin = "tms";
    public static String rootPass = "123456";

    public static String LANG_EN = "en";
    public static String LANG_VN = "vi";
    public static String LANG_JP = "ja";

    //Status of Oder
    public static String All = "All";
    public static String New = "new";
    public static String Cooking = "cooking";
    public static String Cooked = "cooked";
    public static String Served = "served";
    public static String Deny = "deny";
    public static String Done = "done";


    //Status of Push Message
    public static String Menu = "MENU";
    public static String Order = "ORDER";
    public static String Item = "ITEM";
    public static String Default = "Default";


    //Define action log
    public static String Delete = "delete";
    public static String Update = "update";
    public static String Create = "create";
    public static String Login = "login";
    public static String Logout = "logout";

    public static String TbMenu = "menu";
    public static String TbItem = "item";
    public static String TbSubItem = "subitem";
    public static String TbOrder = "order";
    public static String TbOrderItem = "orderitem";
    public static String TbUser = "user";




    public static Bitmap ResizeBitmap(Bitmap src, int maxWidth, int maxHeight)
    {
        // original dimensions
        int w = src.Width;
        int h = src.Height;

        // Longest and shortest dimension
        int longestDimension = (w > h) ? w : h;
        int shortestDimension = (w < h) ? w : h;

        // propotionality
        float factor = ((float)longestDimension) / shortestDimension;

        // default width is greater than height
        double newWidth = maxWidth;
        double newHeight = maxWidth / factor;

        // if height greater than width recalculate
        if (w < h)
        {
            newWidth = maxHeight / factor;
            newHeight = maxHeight;
        }

        // Create new Bitmap at new dimensions
        Bitmap result = new Bitmap((int)newWidth, (int)newHeight);
        using (Graphics g = Graphics.FromImage((System.Drawing.Image)result))
            g.DrawImage(src, 0, 0, (int)newWidth, (int)newHeight);
        return result;
    }


    //Status of Device login Message
    public static String Message1 = "Login failure, device's already login";
    public static String Message2 = "Success, This account was logut in other device";
    public static String Message3 = "Success";
    public static String Message4 = "Login failure, Register device is maximum";

    //Delete Item, Menu, Device, Company, Restaurant. Fill these item in Excel file

    public static String ErrorTitle = "ErrorTitle";
    public static String ErrorDeleteItem = "ErrorDeleteItem";

    //Delete Book
    public static String ErrorDeleteUser = "ErrorDeleteUser";
    


    //Error check date...
    public static String ErrorCheckDate = "ErrorCheckDate";

    //Load user status 
    public static String AllUser = "all";
    public static String Active = "active";
    public static String Deactive = "deactive";
    public static String Waiter = "waiter";
    public static String Chef = "chef";
    public static String Customer = "customer";
    public static int ChefRight = 5;
    public static int WaiterRight=4;
    public static int CustomerRight = 6;

    //Load user type.
    public static String TMAAdmin = "TMAAdmin";
    public static String DisAdmin = "DisAdmin";
    public static String ResAdmin = "ResAdmin";
    public static int TMAAdmin_Right = 1;
    public static int DisAdmin_Right = 2;
    public static int ResAdmin_Right = 3;


}
